In programming environments, users or programmers create source program code and use a compiler to translate the source program into a target program with equivalent behavior. A common target language is machine code which can be directly executed on hardware. Some programming languages allow users or programmers to embed compiler directives in the source program code to provide the compiler with information on how to compile the source program code. These directives usually lead to more efficient target code but do not change the behavior of correct programs. For example, a compiler directive can provide the compiler with information on whether to do range checking on array indexes. In the C programming language, a compiler directive is called a pragma (pragmatic information).
In conventional programming environments, the compiler directives unconditionally apply to the source program code. Also, the compiler directives appear at the top level of the source program code in the conventional programming environments. In some programming instances, however, it is desirable to apply compiler directives only under certain conditions. In other instances, it is needed to introduce compiler directives at the second or lower level of the source program code.
The C programming language supports conditional processing through use of a pre-processor. The C pre-processor can be thought of as a string processing utility that has limited knowledge of C. The pre-processor uses inputs supplied by the user to determine which C code to emit.
Because the C pre-processor directives are processed separately from compilation, none of the context information available to the compiler can be used. Therefore the C pre-processor directives are not part of the C program but rather a separate program that is run before the final C program is compiled.